home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 505 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.ahc.ameritech.com!datalytics!news
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Operator Overloading
  5. Date: 4 Jan 1996 21:47:17 GMT
  6. Organization: Datalytics, Inc
  7. Message-ID: <4chht5$s2h@gold.datalytics.com>
  8. References: <4chdhb$g64@news.cs.hope.edu>
  9. NNTP-Posting-Host: pc071.datalytics.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  14.  
  15. vnopstal@cs.hope.edu (Michael Van Opstall) wrote:
  16. >A couple of questions on operator overloading:
  17. >
  18. >1. If you overload ==, do you have to overload != as well?
  19. >
  20. If you supply the one, someone will code the opposite 
  21. conditional sometime and expect to be able to use the other.  
  22. Likewise, if you provide ++(+, *, etc.), you should seriously 
  23. consider --(-, /, etc.).
  24.  
  25. >2. What is the accepted method for overloading >> and <<? The way I do it
  26. >is not very cool and not slick at all. Should I be including streams and doing
  27. >stream manipulation? That makes sense.
  28. >
  29. If you're doing streams manipulation, do streams manipulation.  
  30. Remember, >> and << were (are) bit shift operators.  The 
  31. iostreams classes changed that behavior.  Was that the right 
  32. thing to do?  Perhaps for your class bit shifting is the right 
  33. behavior for these operators.
  34.  
  35. -- 
  36. Robert Stewart        | My opinions are usually my own.
  37. Datalytics, Inc.
  38. (513)226-7700
  39. stew@datalytics.com
  40.  
  41.  
  42.